import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class ChatServer {
    public static void main(String[] args) {
        try {
            ServerSocket server = new ServerSocket(9900);
            while(true) {
                Socket socket = server.accept();
                //启动线程处理和客户端的通信
                //接收客户端输入吧的姓名,使用输入流InputStream

                new ChatChannel(socket).start();
            }

        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
